package com.damon;

import com.damon.JDBC.DVCJDBC;
import com.damon.JDBC.MonitorConfigJDBC;
import com.damon.entity.DVCEntity;
import com.damon.log.WcsLog;
import com.damon.thread.SocketThread;
import com.damon.utils.GlobalOjbectUtil;
import com.damon.utils.LogUtil;
import com.damon.utils.ThreadPoolUtil;
import com.damon.window.WcsWindow;

public class WcsMonitorRun {
//	static Logger logger = LoggerFactory.getLogger(WcsPrinterRun.class);
//	public static Map<String, Queue<String>> addressMap = new HashMap<>();
	public static void main(String[] args) {
		//实例化可视化界面
		WcsWindow wcsWindow = new WcsWindow();
		GlobalOjbectUtil.setWindow(wcsWindow);
		//加载日志
		WcsLog logger = LogUtil.getLogger(WcsMonitorRun.class);
		

		
		logger.info("检测监控数据配置。。。。。。。。");
		GlobalOjbectUtil.getConfigList().addAll(MonitorConfigJDBC.getMonitorConfigByBitList());
		logger.info("配置数据："+GlobalOjbectUtil.getConfigList());
		
		logger.info("检测待连接设备。。。。。。。。");
		GlobalOjbectUtil.getDeviceList().addAll(DVCJDBC.getDeviceList());
		//为每个设备创建连接
		logger.info("已检测到："+GlobalOjbectUtil.getDeviceList().size()+" 个待连接设备，开始连接！");
		for(DVCEntity device : GlobalOjbectUtil.getDeviceList()) {
			ThreadPoolUtil.getExecutor().execute(new SocketThread(device));
		}
		
		
		
	
		
		
	}
	
}
